CPPFLAGS=-Wall -O1 -c -Iinclude

all: bin/tcp_client bin/tcp_server

bin/tcp_client: build/tcp_client.o build/socket.o Makefile
	g++ -o $@ build/tcp_client.o build/socket.o

bin/tcp_server: build/tcp_server.o build/socket.o Makefile
	g++ -o $@ build/tcp_server.o build/socket.o

build/tcp_client.o:src/tcp_client.cpp include/socket.hpp Makefile
	g++ $(CPPFLAGS) -o $@ $<

build/tcp_server.o:src/tcp_server.cpp include/socket.hpp Makefile
	g++ $(CPPFLAGS) -o $@ $<

build/socket.o:src/socket.cpp include/socket.hpp Makefile
	g++ $(CPPFLAGS) -o $@ $<

.PHONY: all clean

clean:
	@rm -f build/*

dist-clean:
	@rm -f bin/* build/*